home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48hor1
/
array.doc
< prev
next >
Wrap
Text File
|
1995-03-31
|
2KB
|
91 lines
(Comp.sys.handhelds)
Item: 2362 by ppetto at NCoast.ORG
Author: [Peter Petto]
Subj: HP48 Vectors to Array?
Date: Fri Mar 08 1991
An HP-48SX question ... I would like to combine two vectors
into an array as follows
[ 2 4 6 8 ] plus [ 2 9 27 81 ]
to get
[[ 2 4 6 8 ]
[ 3 9 27 81 ]]
I have been able to do this manually (via the MatrixWriter
application) but not under progam control. Can anyone offer
any advice? (Thanks.)
---
Peter Petto | ppetto@ncoast.org
Bay Village, Ohio | 73125.617@compuserve.com
----------
Resp: 2 of 3 by bson at fruit-and-fibre.ai.mit.edu
Author: [Jan Brittenson]
Date: Sat Mar 09 1991 11:24
How about:
<< SWAP ARRY-> LIST-> DROP
DUP 2 + ROLL ARRY-> LIST-> DROP
DUP 2 + ROLL + 2 SWAP OVER / OVER
->LIST ->ARRY
>>
Assuming the sum of the vector sizes is even.
-- Jan Brittenson
bson@ai.mit.edu
Read my lisp: no new classes!
----------
Resp: 3 of 3 by rouben at math13.math.umbc.edu
Author: [Rouben Rostamian]
Date: Sat Mar 09 1991 15:12
Here is a somewhat shorter version (53 bytes compared to 73) of the
program above:
Checksum: #23189d
Bytes: 53
<< SWAP OBJ-> OBJ-> DROP 1 + ROLL
OBJ-> OBJ-> DROP 2 SWAP
2 ->LIST ->ARRY
>>
--
Rouben Rostamian Telephone: (301) 455-2458
Department of Mathematics and Statistics e-mail:
University of Maryland Baltimore County bitnet: rostamian@umbc.bitnet
Baltimore, MD 21228, U.S.A. internet: rouben@math9.math.umbc.edu
----------
Item: 2370 by sburke at jarthur.Claremont.EDU
Author: [Scott Burke]
Subj: 2 Vectors -> Array
Date: Sat Mar 09 1991
Hey, while we're at it, here's an even _shorter_ version, which saves 10 more
bytes:
<<
SWAP OBJ-> EVAL @ EVAL replaces OBJ-> DROP
1 + ROLL OBJ->
2 SWAP + ->ARRY @ why blow up the list if you're going to re-make it?
>>
Checksum # 52064d; 37.5 bytes for the program object
Scott.
sburke@jarthur.claremont.edu